<?php
/**
 * Created by PhpStorm.
 * User: ibenchu-014
 * Date: 2017/1/19
 * Time: 18:01
 */

namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;

class CategroyRequest extends FormRequest
{
    public function authorize()
    {
        return true;
    }
    
    public function rules()
    {
        return [
            'pid'       =>  'required|numeric',
            'name'      =>  'required|string|unique:categorys,name',
            'private'   =>  'required|numeric',
        ];
    }

    public function messages()
    {
        return [
            'pid.required'      =>  '上级栏目未选择',
            'pid.numberic'      =>  '上级栏目不合法',
            'name.required'     =>  '栏目名称未填写',
            'name.string'       =>  '栏目名称不正确',
            'name.unique'       =>  '栏目名称已存在',
            'private.required'  =>  '是否私有未选择',
            'private.numeric'   =>  '是否私有不合法',
        ];
    }
}